package testcase;

import junit.framework.TestCase;
import validation.*;
import card.Card;
import card.Cardset;

public class EvaluatorTest extends TestCase{
	private Evaluator evaluator;
	private Cardset cardset;

	@Override
	public void setUp(){
		evaluator = new Evaluator();
	}
	
	@Override
	public void tearDown(){
		evaluator.newRound();
	}
	
	public void testTypePrior_1(){
		cardset = new Cardset(2);
		cardset.add(new Card('s','J'));
		cardset.add(new Card('c','J'));
		evaluator.successHand(cardset);
		Cardset temp = new Cardset(4);
		temp.add(new Card('s','A'));
		temp.add(new Card('h','A'));
		temp.add(new Card('c','A'));
		temp.add(new Card('d','A'));
		boolean result = evaluator.successHand(temp);
		assertEquals(result, true);
	}

	public void testTypePrior_2(){
		cardset = new Cardset(2);
		cardset.add(new Card('s','J'));
		cardset.add(new Card('c','J'));
		evaluator.successHand(cardset);
		Cardset temp1 = new Cardset(4);
		temp1.add(new Card('s','3'));
		temp1.add(new Card('h','3'));
		temp1.add(new Card('c','3'));
		temp1.add(new Card('d','3'));
		Cardset temp2 = new Cardset(2);
		temp2.add(new Card('g','R'));
		temp2.add(new Card('g','B'));
		evaluator.successHand(temp1);
		boolean result = evaluator.successHand(temp2);
		assertEquals(result, true);
	}
	
	public void testTypePrior_3(){
		cardset = new Cardset(2);
		cardset.add(new Card('g','B'));
		cardset.add(new Card('g','R'));
		evaluator.successHand(cardset);
		Cardset temp = new Cardset(4);
		temp.add(new Card('s','K'));
		temp.add(new Card('h','K'));
		temp.add(new Card('c','K'));
		temp.add(new Card('d','K'));
		boolean result = evaluator.successHand(temp);
		assertEquals(result, false);
	}
	
	public void testTypePrior_4(){
		cardset = new Cardset(2);
		cardset.add(new Card('g','B'));
		cardset.add(new Card('g','R'));
		evaluator.successHand(cardset);
		Cardset temp = new Cardset(2);
		temp.add(new Card('s','K'));
		temp.add(new Card('h','K'));
		boolean result = evaluator.successHand(temp);
		assertEquals(result, false);
	}
	
	public void testTypePrior_5(){
		cardset = new Cardset(4);
		cardset.add(new Card('s','8'));
		cardset.add(new Card('c','8'));
		cardset.add(new Card('h','8'));
		cardset.add(new Card('d','8'));		
		evaluator.successHand(cardset);
		Cardset temp1 = new Cardset(2);
		temp1.add(new Card('d','K'));
		temp1.add(new Card('h','K'));
		Cardset temp2 = new Cardset(2);
		temp2.add(new Card('g','R'));
		temp2.add(new Card('g','B'));
		evaluator.successHand(temp1);
		boolean result = evaluator.successHand(temp2);
		assertEquals(result, true);
	}
	
	public void testSuccessHand(){
		cardset = new Cardset(2);
		cardset.add(new Card('s','8'));
		cardset.add(new Card('c','8'));	
		evaluator.successHand(cardset);
		Cardset temp = new Cardset(2);
		temp.add(new Card('d','K'));
		temp.add(new Card('g','R'));
		boolean result = evaluator.successHand(temp);
		assertEquals(result, false);		
	}
}
